package com.cloud.bc.controller;

import cn.hutool.core.util.StrUtil;
import com.cloud.bc.model.domain.UserInfo;
import com.cloud.bc.model.entity.BcSingleContacts;
import com.cloud.bc.model.entity.BcSingles;
import com.cloud.bc.model.entity.BcUserPhotos;
import com.cloud.bc.model.enums.PhotoEnum;
import com.cloud.bc.service.*;
import com.cloud.bc.util.OrderNoUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping("m/center/photo")
@AllArgsConstructor
public class MCenterPhotoController extends BaseController {
    private final BcUsersService bcUsersService;
    private final BcSinglesService bcSinglesService;
    private final BcSingleMatesService bcSingleMatesService;
    private final BcUserPhotosService bcUserPhotosService;
    private final BcSingleContactsService bcSingleContactsService;

    /**
     * 相册
     */
    @GetMapping("")
    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = baseView(request,"相册", "m/center/photo/index");
        UserInfo userInfo = bcUsersService.getUserInfo(request);
        BcUserPhotos bcUserPhotos = new BcUserPhotos();
        bcUserPhotos.setUserId(userInfo.getId());
        bcUserPhotos.setTitle(PhotoEnum.ALBUM.getTitle());
        List<BcUserPhotos> albumList = bcUserPhotosService.selectAll(bcUserPhotos);
        view.addObject("photo", albumList);
        return view;
    }



}
